.class final Lcom/burstly/lib/feature/AssetResourceResolver;
.super Lcom/h2/org/springframework/beans/factory/ResourceResolver;
.source "AssetResourceResolver.java"


# static fields
.field private static final LOG:Lcom/burstly/lib/util/LoggerExt; = null

.field private static final TAG:Ljava/lang/String; = "AssetResourceResolver"


# instance fields
.field private mAssetManager:Landroid/content/res/AssetManager;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 39
    invoke-static {}, Lcom/burstly/lib/util/LoggerExt;->getInstance()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/feature/AssetResourceResolver;->LOG:Lcom/burstly/lib/util/LoggerExt;

    return-void
.end method

.method constructor <init>()V
    .locals 0

    .prologue
    .line 34
    invoke-direct {p0}, Lcom/h2/org/springframework/beans/factory/ResourceResolver;-><init>()V

    return-void
.end method


# virtual methods
.method protected resolveClassPath(Ljava/lang/String;Z)Ljava/lang/String;
    .locals 3
    .parameter "path"
    .parameter "searchSubDirectories"

    .prologue
    .line 54
    :try_start_0
    const-string v1, "/"

    invoke-virtual {p1, v1}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v1

    if-nez v1, :cond_0

    const-string v1, "\\"

    invoke-virtual {p1, v1}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_1

    .line 55
    :cond_0
    const/4 v1, 0x1

    invoke-virtual {p1, v1}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object v1

    const-string v2, ""

    invoke-virtual {p0, v1, v2, p2}, Lcom/burstly/lib/feature/AssetResourceResolver;->resolveClassPathHelper(Ljava/lang/String;Ljava/lang/String;Z)Ljava/lang/String;

    move-result-object p1

    .line 62
    .end local p1
    :goto_0
    return-object p1

    .line 57
    .restart local p1
    :cond_1
    const-string v1, ""

    invoke-virtual {p0, p1, v1, p2}, Lcom/burstly/lib/feature/AssetResourceResolver;->resolveClassPathHelper(Ljava/lang/String;Ljava/lang/String;Z)Ljava/lang/String;
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object p1

    goto :goto_0

    .line 59
    :catch_0
    move-exception v0

    .line 60
    .local v0, exp:Ljava/io/IOException;
    sget-object v1, Lcom/burstly/lib/feature/AssetResourceResolver;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v2, "AssetResourceResolver"

    invoke-virtual {v1, v2, v0}, Lcom/burstly/lib/util/LoggerExt;->logThrowable(Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_0
.end method

.method protected resolveClassPathHelper(Ljava/lang/String;Ljava/lang/String;Z)Ljava/lang/String;
    .locals 10
    .parameter "path"
    .parameter "topDir"
    .parameter "searchSubDirectories"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 76
    iget-object v8, p0, Lcom/burstly/lib/feature/AssetResourceResolver;->mAssetManager:Landroid/content/res/AssetManager;

    invoke-virtual {v8, p2}, Landroid/content/res/AssetManager;->list(Ljava/lang/String;)[Ljava/lang/String;

    move-result-object v7

    .line 77
    .local v7, subDirs:[Ljava/lang/String;
    new-instance v5, Lorg/springframework/util/AntPathMatcher;

    invoke-direct {v5}, Lorg/springframework/util/AntPathMatcher;-><init>()V

    .line 78
    .local v5, pathMatcher:Lorg/springframework/util/AntPathMatcher;
    const/4 v6, 0x0

    .line 79
    .local v6, result:Ljava/lang/String;
    move-object v0, v7

    .local v0, arr$:[Ljava/lang/String;
    array-length v4, v0

    .local v4, len$:I
    const/4 v3, 0x0

    .local v3, i$:I
    :goto_0
    if-ge v3, v4, :cond_3

    aget-object v1, v0, v3

    .line 80
    .local v1, file:Ljava/lang/String;
    const-string v8, ""

    invoke-virtual {v8, p2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v8

    if-eqz v8, :cond_0

    move-object v2, v1

    .line 81
    .local v2, fullname:Ljava/lang/String;
    :goto_1
    invoke-virtual {v5, p1, v2}, Lorg/springframework/util/AntPathMatcher;->matchStart(Ljava/lang/String;Ljava/lang/String;)Z

    move-result v8

    if-eqz v8, :cond_1

    .line 82
    move-object v6, v2

    .line 83
    iget-object v8, p0, Lcom/burstly/lib/feature/AssetResourceResolver;->mAssetManager:Landroid/content/res/AssetManager;

    invoke-virtual {v8, v1}, Landroid/content/res/AssetManager;->list(Ljava/lang/String;)[Ljava/lang/String;

    move-result-object v8

    array-length v8, v8

    if-eqz v8, :cond_2

    .line 84
    invoke-virtual {p0, p1, v2, p3}, Lcom/burstly/lib/feature/AssetResourceResolver;->resolveClassPathHelper(Ljava/lang/String;Ljava/lang/String;Z)Ljava/lang/String;

    move-result-object v8

    .line 93
    .end local v1           #file:Ljava/lang/String;
    .end local v2           #fullname:Ljava/lang/String;
    :goto_2
    return-object v8

    .line 80
    .restart local v1       #file:Ljava/lang/String;
    :cond_0
    new-instance v8, Ljava/lang/StringBuilder;

    invoke-direct {v8}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v8, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    sget-char v9, Ljava/io/File;->separatorChar:C

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    goto :goto_1

    .line 86
    .restart local v2       #fullname:Ljava/lang/String;
    :cond_1
    if-eqz p3, :cond_2

    .line 87
    invoke-virtual {p0, p1, v2, p3}, Lcom/burstly/lib/feature/AssetResourceResolver;->resolveClassPathHelper(Ljava/lang/String;Ljava/lang/String;Z)Ljava/lang/String;

    move-result-object v6

    .line 89
    :cond_2
    if-eqz v6, :cond_4

    .end local v1           #file:Ljava/lang/String;
    .end local v2           #fullname:Ljava/lang/String;
    :cond_3
    move-object v8, v6

    .line 93
    goto :goto_2

    .line 79
    .restart local v1       #file:Ljava/lang/String;
    .restart local v2       #fullname:Ljava/lang/String;
    :cond_4
    add-int/lit8 v3, v3, 0x1

    goto :goto_0
.end method
